<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title>村组列表</title>

    <link rel="shortcut icon" href="favicon.ico"> <link href="__PUBLIC__/Theme1/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">

    <!-- Data Tables -->
    <link href="__PUBLIC__/Theme1/css/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">

    <link href="__PUBLIC__/Theme1/css/animate.min.css" rel="stylesheet">
    <link href="__PUBLIC__/Theme1/css/style.min.css?v=4.1.0" rel="stylesheet">

    <link href="__PUBLIC__/Theme1/css/newstyle.css" rel="stylesheet">

</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>村组信息 <a href="__URL__/add" style="margin-left: 15px; color: #06cbc4">添加村组</a></h5>
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>

                    <div class="ibox-content">
                        <form method="post" action="__URL__/listsedit" class="form-horizontal" id="searchForm" enctype="multipart/form-data">

                            <div class="form-group">
                                <label class="col-sm-1 control-label">所属地区</label>
                                <div class="col-sm-7" >
                                    <select class="selectRegione"  name="regione1" >
                                        <php>
                                            if(count($regione1)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione1" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione1id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                    </select>

                                    <select class="selectRegione"  name="regione2" <php>if(empty($regione2)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione2)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione2)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione2" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione2id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>

                                    <select class="selectRegione"  name="regione3" <php>if(empty($regione3)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione3)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione3)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione3" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione3id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>

                                    <select class="selectRegione"  name="regione4" <php>if(empty($regione4)){</php>style="display: none"<php>}</php> >
                                        <php>if(empty($regione4)){</php>
                                        <option value="0">请选择</option>
                                        <php>}else{
                                            if(count($regione4)>1){
                                            echo "<option value='0'>请选择</option>";
                                            }
                                        </php>
                                        <foreach name="regione4" item="val" key="k">
                                            <option value="<{$val.id}>" <if condition="$val.id eq $regione4id">selected = "selected"</if>><{$val.name}></option>
                                        </foreach>
                                        <php>}</php>
                                    </select>
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="col-sm-4 col-sm-offset-2">
                                    <input name="page" type="hidden" />
                                    <button class="btn btn-primary" id="search" type="button">查询</button>
                                </div>
                            </div>
                        </form>
                    </div>


                    <div class="ibox-content">

                        <table class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                                <tr>
                                    <th>村组ID</th>
                                    <th>村组名称</th>
                                    <th  class="dropdown hidden-xs">所属地区</th>
                                    <th  class="dropdown hidden-xs">村组负责人</th>
                                    <th  class="dropdown hidden-xs">负责人电话</th>
                                    <if condition="(session('aPowers') lt 2)"><th>操作</th></if>
                                </tr>
                            </thead>
                            <tbody>
                            <foreach name="rs_department" item="val_department">
                                <tr>
                                    <td><{$val_department.dId}></td>
                                    <td><{$val_department.dName}></td>
                                    <td><{$val_department.pIdname}></td>
                                    <td class="dropdown hidden-xs"><{$val_department.dDirector}></td>
                                    <td class="dropdown hidden-xs"><{$val_department.dDirectorTel}></td>
                                    <if condition="(session('aPowers') lt 2)">
                                    <td><a href="__URL__/listseditupdate/dId/<{$val_department.dId}>"><i class="glyphicon glyphicon-pencil"></i></a> <a style="margin-left: 15px;" onclick="if(confirm('确定删除?')==false)return false;" href="__URL__/DelAction/dId/<{$val_department.dId}>"><i class="glyphicon glyphicon-remove"></i></a></td>
                                    </if>
                                </tr>
                              </foreach>
                            </tbody>
                            
                        </table>
                        <div class="page"><{$page}></div>
                        <div class="clearBoth"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="__PUBLIC__/Theme1/js/jquery.min.js?v=2.1.4"></script>
    <script src="__PUBLIC__/Theme1/js/bootstrap.min.js?v=3.3.6"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/jeditable/jquery.jeditable.js"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/dataTables/jquery.dataTables.js"></script>
    <script src="__PUBLIC__/Theme1/js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <script src="__PUBLIC__/Theme1/js/content.min.js?v=1.0.0"></script>

    <SCRIPT type="text/javascript">
        function gopage(page){
            $("[name='page']").val(page);
            $("#searchForm").submit();
        };
        $(function(){

            $("#search").click(function(){
                $("#searchForm").submit();
            });

            //当第一个选择时，给第二填充数据
            $("[name='regione1']").change(function(){
                $("[name='regione2']").html('<option value="0">加载中...</option>');
                $("[name='regione3']").html('');$("[name='regione3']").hide();
                $("[name='regione4']").html('');$("[name='regione4']").hide();
                var id=$(this).val();
                var html='<option value="0">请选择</option>';
                $.ajax({    //ajax方法获取选定区域的下级区域列表
                    url:"/Personnelsystem/Department/getChildId",
                    data:{id:id},
                    dataType:'json',
                    type:'post',
                    success:function(re){
                        var html='<option value="0">请选择</option>';
                        var item=re;
                        for(var i in item){
                            html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                        }
                        $("[name='regione2']").html(html);
                        $("[name='regione2']").show();
                    }
                })
            });
            //当第2个选择时，给第3填充数据
            $("[name='regione2']").change(function(){
                $("[name='regione3']").html('<option value="0">加载中...</option>');
                $("[name='regione4']").html('');$("[name='regione4']").hide();
                var id=$(this).val();
                var html='<option value="0">请选择</option>';
                $.ajax({    //ajax方法获取选定区域的下级区域列表
                    url:"/Personnelsystem/Department/getChildId",
                    data:{id:id},
                    dataType:'json',
                    type:'post',
                    success:function(re){
                        var html='<option value="0">请选择</option>';
                        var item=re;
                        for(var i in item){
                            html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                        }
                        $("[name='regione3']").html(html);
                        $("[name='regione3']").show();
                    }
                })
            });
            //当第3个选择时，给第4填充数据
            $("[name='regione3']").change(function(){
                $("[name='regione4']").html('<option value="0">加载中...</option>');
                var id=$(this).val();
                var html='<option value="0">请选择</option>';
                $.ajax({    //ajax方法获取选定区域的下级区域列表
                    url:"/Personnelsystem/Department/getChildId",
                    data:{id:id},
                    dataType:'json',
                    type:'post',
                    success:function(re){
                        var html='<option value="0">请选择</option>';
                        var item=re;
                        for(var i in item){
                            html +='<option value="'+item[i]['id']+'" >'+item[i]['name']+'</option>';
                        }
                        $("[name='regione4']").html(html);
                        $("[name='regione4']").show();
                    }
                })
            });

        })

    </SCRIPT>

</body>

</html>
